package com.devilvan.betrice.aiqicha.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.devilvan.betrice.aiqicha.dto.AiqichaTradeMarkDto;
import com.devilvan.betrice.aiqicha.po.AiqichaTradeMarkPo;
import com.devilvan.betrice.aiqicha.service.AiqichaTradeMarkService;
import com.devilvan.betrice.aiqicha.mapper.AiqichaTradeMarkMapper;
import com.devilvan.betrice.aiqicha.repository.AiqichaTradeMarkRepository;
import com.devilvan.betrice.util.UCopy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author Evad.Wu
* @Description 爱企查-商标信息 业务逻辑类
* @date 2022-09-24
*/
@Service
public class AiqichaTradeMarkServiceImpl extends ServiceImpl<AiqichaTradeMarkMapper, AiqichaTradeMarkPo> implements AiqichaTradeMarkService {
    @Resource(name = "aiqichaTradeMarkRepository")
    private AiqichaTradeMarkRepository aiqichaTradeMarkRepository;

    @Override
    public AiqichaTradeMarkPo saveUpdate(AiqichaTradeMarkDto aiqichaTradeMarkDto) {
        AiqichaTradeMarkPo aiqichaTradeMarkPo = new AiqichaTradeMarkPo();
        UCopy.fullCopy(aiqichaTradeMarkDto, aiqichaTradeMarkPo);
        return aiqichaTradeMarkRepository.saveAndFlush(aiqichaTradeMarkPo);
    }

    @Override
    public List<AiqichaTradeMarkPo> saveUpdateBatch(List<AiqichaTradeMarkDto> list) {
        List<AiqichaTradeMarkPo> aiqichaTradeMarkPoList = UCopy.fullCopyCollections(list, AiqichaTradeMarkPo.class);
        return aiqichaTradeMarkRepository.saveAllAndFlush(aiqichaTradeMarkPoList);
    }
}
